<template>
  <div class="project">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper"></div>

    <!-- 操作按钮区域 -->

    <el-table border
              v-loading="loading"
              size="small"
              :data="dataSource"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              :default-sort = "{prop: 'startDate', order: 'descending'}">
<!--        <el-table-column prop="assetId" label="资产ID" sortable></el-table-column>-->
        <el-table-column prop="startDate" label="送修时间" sortable></el-table-column>
        <el-table-column prop="contacts" label="联系人" sortable></el-table-column>
        <el-table-column prop="phone" label="联系电话" sortable></el-table-column>
        <el-table-column prop="finishDate" label="完成时间" sortable></el-table-column>
        <el-table-column prop="accepPhoto" label="验收单" >
          <template>
            <span v-for="(item,index) in photos" :key="index">
              <el-popover
                placement="right"
                title=""
                trigger="hover">
                <img :src="['http://172.16.1.185:8080/asset-server/' + item]" />
                <img slot="reference"  :src="['http://172.16.1.185:8080/asset-server/' + item]" :alt="['http://172.16.1.185:8080/asset-server/' + item]"  style="max-height: 50px;max-width: 130px">
              </el-popover>
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="note" label="备注" ></el-table-column>
    </el-table>
    <pagination :total="ipagination.total" :page.sync="ipagination.current" :limit.sync="ipagination.pageSize"
    @pagination="loadData"></pagination>
  </div>
</template>

<script>
  /* eslint-disable */
  import { SingleTableMixins } from '@/mixins/SingleTableMixins'
  import Pagination from '@/components/Pagination'
  import { getAction } from "@/api/manage";



  export default {
    mixins: [ SingleTableMixins ],
    components: {Pagination},
    name: "repairRecord",
    data () {
      return{
        ipagination:{
          pageSize: 10,
          current:1,
          total: 0,
        },
        photos: [],
        disableMixinCreated:true,
        url:{
          list: `/repair/listByMainId`
        }
      }
    },
    created () {

    },
    methods: {
      getDataByMain(id) {
        let that = this
        let each
        this.url.list = `/repair/listByMainId/${id}`;
        this.loadData(1);
        getAction(`/repair/listByMainId/${id}`).then(res => {
          for(each of res.data.records){
            if(each.hasOwnProperty("accepPhoto")){
              if(each.accepPhoto.search(',') != -1){
              that.photos = each.accepPhoto.split(',')
              }else{
                that.photos = each.accepPhoto.split(' ')
              }
              console.log(that.photos)
          }
          }

      });

      },
    }
  }
</script>

<style scoped>

</style>
